<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
	String basePath = request.getContextPath();
	String path = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+basePath+"/";
	request.setAttribute("path",path);
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><!doctype html>
<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
	<meta name="format-detection" content="telephone=no,address=no,email=no"/>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<title>确认选片</title>
	<script type="text/javascript" src="${path}/school/js/jquery.js"></script>
	<script type="text/javascript" src="${path}/js/jquery-2.1.1.min.js"></script>
	<link href="${path}/school/css/style.css" rel="stylesheet" media="all">
	<link rel="shortcut icon" href="${path}/school/img/favicon.png">
</head>
<body>
	<header class="top_header">
		<h1><a href="javascript:history.go(-1);" class="go_back"></a><span>确认选片</span></h1>
	</header><!-- header -->
	<div class="content_wrap kaselect_wrap">
		<div class="ka_select ka_conselect">
			<ul>
				<c:forEach items="${sampleList}" var="item">
				<li>
					<input name="kaselect_img_${item.id}" type="checkbox" id="kaselect_one_${item.id}" value="${item.id}" onClick="doCheck(${item.id})">
					<label class="kaselect_lable" for="kaselect_one_${item.id}">
						<span class="kaselect_bg"></span>
						<i class="kaselect_icon"></i>
						<a href="#"><img src="${path}${item.photoes}"></a>
					</label>
				</li>
				</c:forEach>
				<div class="clear"></div>
			</ul>
			
			<div class="kaconselect_nav">
				<a class="kareselect_nav" onclick="selectSample()">重新选择</a>
				<a onclick="addSample()">确认选择</a>
			</div><!-- kasampledet_nav -->
			<p class="kaconselect_det"><span>*</span>一旦确认，不可修改</p>
		</div><!-- ka_samplerel -->
		
	</div><!-- content_wrap -->

	<form id="form1" name="form1" method="post" action="${path}/toSelect">
		<input id="ids" name="ids" value="" style="display: none">
		<input id="themeId" name="themeId" value="${themeId}" style="display: none">
		<input name="orderId" value="${orderId}" style="display: none">
	</form>
	<form id="form2" name="form2" method="post" action="${path}/addSelectSample">
		<input id="idss" name="idss" value="${ids}" style="display: none">
		<input name="orderId" value="${orderId}" style="display: none">
	</form>
	<div class="footer_copyright">
		<p><span>苏州知行合一网络科技有限公司</span>提供技术支持，版权所有</p>
	</div><!-- footer_copyright -->
</body>
<script>
    var c=0,limit=10;
    function doCheck(obj) {
        var sampleId=$("#kaselect_one_"+obj).val();
        var id =$("#ids").val();
        var aa=id.split(",");
        var ss="";
        if(aa.length<=limit){
            ss+=id+","+sampleId;
            $("#ids").val(ss);
        }
        //alert(id);
       /* var sampleId=$("#kaselect_one_"+obj).val();
        var id ="";
        var ss="";
        ss+=id+","+sampleId;
        alert(ss);
        $("#ids").val(ss);*/
    }

    function selectSample() {
        var id =$("#ids").val();
       // alert(id);
        if (id!=null&&id!=""){
            document.getElementById("form1").submit();
		}else {
            alert("重新选择需要先选中保留的!")
		}
    }

    function addSample() {
        //var id =$("#idss").val();
        //alert(id)
        //$("#idss").val(id)
        document.getElementById("form2").submit();
    }
</script>
</html>